home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / TeX-inputs / LaTeX / contrib / tugboat / ltugbib.bst next >
Text File  |  1997-03-26  |  20KB  |  1,155 lines

  1. %%
  2. %% This is file `ltugbib.bst',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% tugboat.dtx  (with options: `tugbib')
  8. %% 
  9. ENTRY
  10.   { address
  11.     author
  12.     booktitle
  13.     chapter
  14.     edition
  15.     editor
  16.     howpublished
  17.     institution
  18.     journal
  19.     key
  20.     month
  21.     note
  22.     number
  23.     organization
  24.     pages
  25.     publisher
  26.     school
  27.     series
  28.     title
  29.     type
  30.     volume
  31.     year
  32.   }
  33.   {}
  34.   { label extra.label sort.label long.label short.label }
  35.  
  36. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  37.  
  38. FUNCTION {init.state.consts}
  39. { #0 'before.all :=
  40.   #1 'mid.sentence :=
  41.   #2 'after.sentence :=
  42.   #3 'after.block :=
  43. }
  44.  
  45. STRINGS { s t }
  46.  
  47. FUNCTION {output.nonnull}
  48. { 's :=
  49.   output.state mid.sentence =
  50.     { ", " * write$ }
  51.     { output.state after.block =
  52.         { add.period$ write$
  53.           newline$
  54.           "\newblock " write$
  55.         }
  56.         { output.state before.all =
  57.             'write$
  58.             { add.period$ " " * write$ }
  59.           if$
  60.         }
  61.       if$
  62.       mid.sentence 'output.state :=
  63.     }
  64.   if$
  65.   s
  66. }
  67.  
  68. FUNCTION {output}
  69. { duplicate$ empty$
  70.     'pop$
  71.     'output.nonnull
  72.   if$
  73. }
  74.  
  75. FUNCTION {output.check}
  76. { 't :=
  77.   duplicate$ empty$
  78.     { pop$ "empty " t * " in " * cite$ * warning$ }
  79.     'output.nonnull
  80.   if$
  81. }
  82.  
  83. FUNCTION {output.bibitem}
  84. { newline$
  85.   "\bibitem[" write$
  86.   "\protect\citeauthoryear{" long.label * "}{" * write$
  87.   short.label write$
  88.   "}{" year duplicate$ empty$
  89.     { pop$ "????" }
  90.     'skip$
  91.   if$
  92.   * extra.label * "}]{" * write$
  93.   cite$ write$
  94.   "}" write$
  95.   newline$
  96.   ""
  97.   before.all 'output.state :=
  98. }
  99.  
  100. FUNCTION {fin.entry}
  101. { add.period$
  102.   write$
  103.   newline$
  104. }
  105.  
  106. FUNCTION {new.block}
  107. { output.state before.all =
  108.     'skip$
  109.     { after.block 'output.state := }
  110.   if$
  111. }
  112.  
  113. FUNCTION {new.sentence}
  114. { output.state after.block =
  115.     'skip$
  116.     { output.state before.all =
  117.         'skip$
  118.         { after.sentence 'output.state := }
  119.       if$
  120.     }
  121.   if$
  122. }
  123.  
  124. FUNCTION {not}
  125. {   { #0 }
  126.     { #1 }
  127.   if$
  128. }
  129.  
  130. FUNCTION {and}
  131. {   'skip$
  132.     { pop$ #0 }
  133.   if$
  134. }
  135.  
  136. FUNCTION {or}
  137. {   { pop$ #1 }
  138.     'skip$
  139.   if$
  140. }
  141.  
  142. FUNCTION {new.block.checkb}
  143. { empty$
  144.   swap$ empty$
  145.   and
  146.     'skip$
  147.     'new.block
  148.   if$
  149. }
  150.  
  151. FUNCTION {field.or.null}
  152. { duplicate$ empty$
  153.     { pop$ "" }
  154.     'skip$
  155.   if$
  156. }
  157.  
  158. FUNCTION {emphasize}
  159. { duplicate$ empty$
  160.     { pop$ "" }
  161.  { "{\em " swap$ * "}" * }
  162.   if$
  163. }
  164.  
  165. FUNCTION {bolden}
  166. { duplicate$ empty$
  167.     { pop$ "" }
  168.  { "{\bf " swap$ * "}" * }
  169.   if$
  170. }
  171. INTEGERS { nameptr namesleft numnames }
  172.  
  173. FUNCTION {format.names}
  174. { 's :=
  175.   #1 'nameptr :=
  176.   s num.names$ 'numnames :=
  177.   numnames 'namesleft :=
  178.     { namesleft #0 > }
  179.     { s nameptr
  180.       nameptr #1 =
  181.         { "{vv~}{ll}{, jj}{, ff}" format.name$ }
  182.         { "{f.~}{vv~}{ll}{, jj}" format.name$ }
  183.       if$
  184.       't :=
  185.       nameptr #1 >
  186.         {
  187.           namesleft #1 >
  188.             { ", " * t * }
  189.             {
  190.               numnames #2 >
  191.                 { "," * }
  192.                 'skip$
  193.               if$
  194.               t "others" =
  195.                 { " \etal{}" * }
  196.                 { " and " * t * }
  197.               if$
  198.             }
  199.           if$
  200.         }
  201.         't
  202.       if$
  203.       nameptr #1 + 'nameptr :=
  204.       namesleft #1 - 'namesleft :=
  205.     }
  206.   while$
  207. }
  208.  
  209. FUNCTION {format.names.ed}
  210. { 's :=
  211.   #1 'nameptr :=
  212.   s num.names$ 'numnames :=
  213.   numnames 'namesleft :=
  214.     { namesleft #0 > }
  215.     { s nameptr
  216.       "{f.~}{vv~}{ll}{, jj}"
  217.       format.name$ 't :=
  218.       nameptr #1 >
  219.         {
  220.           namesleft #1 >
  221.             { ", " * t * }
  222.             {
  223.               numnames #2 >
  224.                 { "," * }
  225.                 'skip$
  226.               if$
  227.               t "others" =
  228.                 { " \etal{}" * }
  229.                 { " and " * t * }
  230.               if$
  231.             }
  232.           if$
  233.         }
  234.         't
  235.       if$
  236.       nameptr #1 + 'nameptr :=
  237.       namesleft #1 - 'namesleft :=
  238.     }
  239.   while$
  240. }
  241.  
  242. FUNCTION {format.key}
  243. { empty$
  244.     { key field.or.null }
  245.     { "" }
  246.   if$
  247. }
  248.  
  249. FUNCTION {format.authors}
  250. { author empty$
  251.     { "" }
  252.     { author format.names }
  253.   if$
  254. }
  255.  
  256. FUNCTION {format.editors}
  257. { editor empty$
  258.     { "" }
  259.     { editor format.names
  260.       editor num.names$ #1 >
  261.         { ", editors" * }
  262.         { ", editor" * }
  263.       if$
  264.     }
  265.   if$
  266. }
  267.  
  268. FUNCTION {format.in.editors}
  269. { editor empty$
  270.     { "" }
  271.     { editor format.names.ed
  272.     }
  273.   if$
  274. }
  275.  
  276. FUNCTION {format.title}
  277. { title empty$
  278.     { "" }
  279.     { title
  280.       "``" swap$ * "''" *
  281.     }
  282.   if$
  283. }
  284.  
  285. FUNCTION {n.dashify}
  286. { 't :=
  287.   ""
  288.     { t empty$ not }
  289.     { t #1 #1 substring$ "-" =
  290.         { t #1 #2 substring$ "--" = not
  291.             { "--" *
  292.               t #2 global.max$ substring$ 't :=
  293.             }
  294.             {   { t #1 #1 substring$ "-" = }
  295.                 { "-" *
  296.                   t #2 global.max$ substring$ 't :=
  297.                 }
  298.               while$
  299.             }
  300.           if$
  301.         }
  302.         { t #1 #1 substring$ *
  303.           t #2 global.max$ substring$ 't :=
  304.         }
  305.       if$
  306.     }
  307.   while$
  308. }
  309.  
  310. FUNCTION {word.in}
  311. { "In " }
  312.  
  313. FUNCTION {format.date}
  314. { year duplicate$ empty$
  315.     { "empty year in " cite$ * "; set to ????" * warning$
  316.        pop$ "????" }
  317.     'skip$
  318.   if$
  319.   extra.label *
  320. }
  321.  
  322. FUNCTION {format.btitle}
  323. { title emphasize
  324. }
  325.  
  326. FUNCTION {tie.or.space.connect}
  327. { duplicate$ text.length$ #3 <
  328.     { "~" }
  329.     { " " }
  330.   if$
  331.   swap$ * *
  332. }
  333.  
  334. FUNCTION {either.or.check}
  335. { empty$
  336.     'pop$
  337.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  338.   if$
  339. }
  340.  
  341. FUNCTION {format.bvolume}
  342. { volume empty$
  343.     { "" }
  344.     { "volume" volume tie.or.space.connect
  345.       series empty$
  346.         'skip$
  347.         { " of " * series emphasize * }
  348.       if$
  349.       "volume and number" number either.or.check
  350.     }
  351.   if$
  352. }
  353.  
  354. FUNCTION {format.number.series}
  355. { volume empty$
  356.     { number empty$
  357.         { series field.or.null }
  358.         { output.state mid.sentence =
  359.             { "number" }
  360.             { "Number" }
  361.           if$
  362.           number tie.or.space.connect
  363.           series empty$
  364.             { "there's a number but no series in " cite$ * warning$ }
  365.             { " in " * series * }
  366.           if$
  367.         }
  368.       if$
  369.     }
  370.     { "" }
  371.   if$
  372. }
  373.  
  374. FUNCTION {format.edition}
  375. { edition empty$
  376.     { "" }
  377.     { output.state mid.sentence =
  378.         { edition "l" change.case$ " edition" * }
  379.         { edition "t" change.case$ " edition" * }
  380.       if$
  381.     }
  382.   if$
  383. }
  384.  
  385. INTEGERS { multiresult }
  386.  
  387. FUNCTION {multi.page.check}
  388. { 't :=
  389.   #0 'multiresult :=
  390.     { multiresult not
  391.       t empty$ not
  392.       and
  393.     }
  394.     { t #1 #1 substring$
  395.       duplicate$ "-" =
  396.       swap$ duplicate$ "," =
  397.       swap$ "+" =
  398.       or or
  399.         { #1 'multiresult := }
  400.         { t #2 global.max$ substring$ 't := }
  401.       if$
  402.     }
  403.   while$
  404.   multiresult
  405. }
  406.  
  407. FUNCTION {format.pages}
  408. { pages empty$
  409.     { "" }
  410.     { pages multi.page.check
  411.         { "pages" pages n.dashify tie.or.space.connect }
  412.         { "page" pages tie.or.space.connect }
  413.       if$
  414.     }
  415.   if$
  416. }
  417.  
  418. FUNCTION {format.vol.num.pages}
  419. { volume field.or.null
  420.   bolden
  421.   number empty$
  422.     'skip$
  423.     { "(" number * ")" * *
  424.       volume empty$
  425.         { "there's a number but no volume in " cite$ * warning$ }
  426.         'skip$
  427.       if$
  428.     }
  429.   if$
  430.   pages empty$
  431.     'skip$
  432.     { duplicate$ empty$
  433.         { pop$ format.pages }
  434.         { ", " * pages n.dashify * }
  435.       if$
  436.     }
  437.   if$
  438. }
  439.  
  440. FUNCTION {format.chapter.pages}
  441. { chapter empty$
  442.     'format.pages
  443.     { type empty$
  444.         { "chapter" }
  445.         { type "l" change.case$ }
  446.       if$
  447.       chapter tie.or.space.connect
  448.       pages empty$
  449.         'skip$
  450.         { ", " * format.pages * }
  451.       if$
  452.     }
  453.   if$
  454. }
  455.  
  456. FUNCTION {format.in.ed.booktitle}
  457. { booktitle empty$
  458.     { "" }
  459.     { editor empty$
  460.         { word.in booktitle emphasize * }
  461.         { word.in booktitle emphasize * ", edited by " *
  462.           format.in.editors * }
  463.       if$
  464.     }
  465.   if$
  466. }
  467.  
  468. FUNCTION {format.thesis.type}
  469. { type empty$
  470.     'skip$
  471.     { pop$
  472.       type "t" change.case$
  473.     }
  474.   if$
  475. }
  476.  
  477. FUNCTION {format.tr.number}
  478. { type empty$
  479.     { "Technical Report" }
  480.     'type
  481.   if$
  482.   number empty$
  483.     { "t" change.case$ }
  484.     { number tie.or.space.connect }
  485.   if$
  486. }
  487.  
  488. FUNCTION {format.article.crossref}
  489. {
  490.   word.in
  491.   "\cite{" * crossref * "}" *
  492. }
  493.  
  494. FUNCTION {format.book.crossref}
  495. { volume empty$
  496.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  497.       word.in
  498.     }
  499.     { "Volume" volume tie.or.space.connect
  500.       " of " *
  501.     }
  502.   if$
  503.   "\cite{" * crossref * "}" *
  504. }
  505.  
  506. FUNCTION {format.incoll.inproc.crossref}
  507. {
  508.   word.in
  509.   "\cite{" * crossref * "}" *
  510. }
  511.  
  512. FUNCTION {article}
  513. { output.bibitem
  514.   format.authors "author" output.check
  515.   author format.key output
  516.   new.block
  517.   format.title "title" output.check
  518.   new.block
  519.   crossref missing$
  520.     { journal emphasize "journal" output.check
  521.       " " * before.all 'output.state :=
  522.       format.vol.num.pages output
  523.       format.date "year" output.check
  524.     }
  525.     { format.article.crossref output.nonnull
  526.       format.pages output
  527.     }
  528.   if$
  529.   new.block
  530.   note output
  531.   fin.entry
  532. }
  533.  
  534. FUNCTION {book}
  535. { output.bibitem
  536.   author empty$
  537.     { format.editors "author and editor" output.check
  538.       editor format.key output
  539.     }
  540.     { format.authors output.nonnull
  541.       crossref missing$
  542.         { "author and editor" editor either.or.check }
  543.         'skip$
  544.       if$
  545.     }
  546.   if$
  547.   new.block
  548.   format.btitle "title" output.check
  549.   crossref missing$
  550.     { format.bvolume output
  551.       new.block
  552.       format.number.series output
  553.       new.sentence
  554.       publisher "publisher" output.check
  555.       address output
  556.     }
  557.     {
  558.       new.block
  559.       format.book.crossref output.nonnull
  560.     }
  561.   if$
  562.   format.edition output
  563.   format.date "year" output.check
  564.   new.block
  565.   note output
  566.   fin.entry
  567. }
  568.  
  569. FUNCTION {booklet}
  570. { output.bibitem
  571.   format.authors output
  572.   author format.key output
  573.   new.block
  574.   format.title "title" output.check
  575.   new.block
  576.   howpublished output
  577.   address output
  578.   format.date "year" output.check
  579.   new.block
  580.   note output
  581.   fin.entry
  582. }
  583.  
  584. FUNCTION {inbook}
  585. { output.bibitem
  586.   author empty$
  587.     { format.editors "author and editor" output.check
  588.       editor format.key output
  589.     }
  590.     { format.authors output.nonnull
  591.       crossref missing$
  592.         { "author and editor" editor either.or.check }
  593.         'skip$
  594.       if$
  595.     }
  596.   if$
  597.   new.block
  598.   format.btitle "title" output.check
  599.   crossref missing$
  600.     { format.bvolume output
  601.       format.chapter.pages "chapter and pages" output.check
  602.       new.block
  603.       format.number.series output
  604.       new.sentence
  605.       publisher "publisher" output.check
  606.       address output
  607.     }
  608.     { format.chapter.pages "chapter and pages" output.check
  609.       new.block
  610.       format.book.crossref output.nonnull
  611.     }
  612.   if$
  613.   format.edition output
  614.   format.date "year" output.check
  615.   new.block
  616.   note output
  617.   fin.entry
  618. }
  619.  
  620. FUNCTION {incollection}
  621. { output.bibitem
  622.   format.authors "author" output.check
  623.   author format.key output
  624.   new.block
  625.   format.title "title" output.check
  626.   new.block
  627.   crossref missing$
  628.     { format.in.ed.booktitle "booktitle" output.check
  629.       format.bvolume output
  630.       format.number.series output
  631.       format.chapter.pages output
  632.       new.sentence
  633.       publisher "publisher" output.check
  634.       address output
  635.       format.edition output
  636.       format.date "year" output.check
  637.     }
  638.     { format.incoll.inproc.crossref output.nonnull
  639.       format.chapter.pages output
  640.     }
  641.   if$
  642.   new.block
  643.   note output
  644.   fin.entry
  645. }
  646.  
  647. FUNCTION {inproceedings}
  648. { output.bibitem
  649.   format.authors "author" output.check
  650.   author format.key output
  651.   new.block
  652.   format.title "title" output.check
  653.   new.block
  654.   crossref missing$
  655.     { format.in.ed.booktitle "booktitle" output.check
  656.       format.bvolume output
  657.       format.number.series output
  658.       format.pages output
  659.       address output
  660.       new.sentence
  661.       organization output
  662.       publisher output
  663.   format.date "year" output.check
  664.     }
  665.     { format.incoll.inproc.crossref output.nonnull
  666.       format.pages output
  667.     }
  668.   if$
  669.   new.block
  670.   note output
  671.   fin.entry
  672. }
  673.  
  674. FUNCTION {conference} { inproceedings }
  675.  
  676. FUNCTION {manual}
  677. { output.bibitem
  678.   format.authors output
  679.   author format.key output
  680.   new.block
  681.   format.btitle "title" output.check
  682.   organization address new.block.checkb
  683.   organization output
  684.   address output
  685.   format.edition output
  686.   format.date "year" output.check
  687.   new.block
  688.   note output
  689.   fin.entry
  690. }
  691.  
  692. FUNCTION {mastersthesis}
  693. { output.bibitem
  694.   format.authors "author" output.check
  695.   author format.key output
  696.   new.block
  697.   format.btitle "title" output.check
  698.   new.block
  699.   "Master's thesis" format.thesis.type output.nonnull
  700.   school "school" output.check
  701.   address output
  702.   format.date "year" output.check
  703.   new.block
  704.   note output
  705.   fin.entry
  706. }
  707.  
  708. FUNCTION {misc}
  709. { output.bibitem
  710.   format.authors output
  711.   author format.key output
  712.   new.block
  713.   format.title output
  714.   new.block
  715.   howpublished output
  716.   format.date "year" output.check
  717.   new.block
  718.   note output
  719.   fin.entry
  720. }
  721.  
  722. FUNCTION {phdthesis}
  723. { output.bibitem
  724.   format.authors "author" output.check
  725.   author format.key output
  726.   new.block
  727.   format.btitle "title" output.check
  728.   new.block
  729.   "Ph.D.\ thesis" format.thesis.type output.nonnull
  730.   school "school" output.check
  731.   address output
  732.   format.date "year" output.check
  733.   new.block
  734.   note output
  735.   fin.entry
  736. }
  737.  
  738. FUNCTION {proceedings}
  739. { output.bibitem
  740.   format.editors output
  741.   editor format.key output
  742.   new.block
  743.   format.btitle "title" output.check
  744.   format.bvolume output
  745.   format.number.series output
  746.   address output
  747.   new.sentence
  748.   organization output
  749.   publisher output
  750.   format.date "year" output.check
  751.   new.block
  752.   note output
  753.   fin.entry
  754. }
  755.  
  756. FUNCTION {techreport}
  757. { output.bibitem
  758.   format.authors "author" output.check
  759.   author format.key output
  760.   new.block
  761.   format.title "title" output.check
  762.   new.block
  763.   format.tr.number output.nonnull
  764.   institution "institution" output.check
  765.   address output
  766.   format.date "year" output.check
  767.   new.block
  768.   note output
  769.   fin.entry
  770. }
  771.  
  772. FUNCTION {unpublished}
  773. { output.bibitem
  774.   format.authors "author" output.check
  775.   author format.key output
  776.   new.block
  777.   format.title "title" output.check
  778.   new.block
  779.   note "note" output.check
  780.   fin.entry
  781. }
  782.  
  783. FUNCTION {default.type} { misc }
  784.  
  785. MACRO {jan} {"January"}
  786.  
  787. MACRO {feb} {"February"}
  788.  
  789. MACRO {mar} {"March"}
  790.  
  791. MACRO {apr} {"April"}
  792.  
  793. MACRO {may} {"May"}
  794.  
  795. MACRO {jun} {"June"}
  796.  
  797. MACRO {jul} {"July"}
  798.  
  799. MACRO {aug} {"August"}
  800.  
  801. MACRO {sep} {"September"}
  802.  
  803. MACRO {oct} {"October"}
  804.  
  805. MACRO {nov} {"November"}
  806.  
  807. MACRO {dec} {"December"}
  808.  
  809. READ
  810.  
  811. FUNCTION {sortify}
  812. { purify$
  813.   "l" change.case$
  814. }
  815.  
  816. INTEGERS { len }
  817.  
  818. FUNCTION {chop.word}
  819. { 's :=
  820.   'len :=
  821.   s #1 len substring$ =
  822.     { s len #1 + global.max$ substring$ }
  823.     's
  824.   if$
  825. }
  826.  
  827. FUNCTION {format.lab.names}
  828. { 's :=
  829.   s #1 "{vv~}{ll}" format.name$
  830.   s num.names$ duplicate$
  831.   #2 >
  832.     { pop$                      % 2nd number of names
  833.       " \etal{}" *
  834.     }
  835.     { #2 <
  836.         'skip$
  837.         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  838.             { " \etal{}" * }
  839.             { " and " * s #2 "{vv~}{ll}" format.name$ * }
  840.           if$
  841.         }
  842.       if$
  843.     }
  844.   if$
  845. }
  846.  
  847. FUNCTION {format.long.lab.names}
  848. { 's :=
  849.   #1 'nameptr :=
  850.   s num.names$ 'numnames :=
  851.   numnames 'namesleft :=
  852.     { namesleft #0 > }
  853.     { s nameptr
  854.       "{vv~}{ll}" format.name$ 't :=
  855.       nameptr #1 >
  856.         {
  857.           namesleft #1 >
  858.             { ", " * t * }
  859.             {
  860.               numnames #2 >
  861.                 { "," * }
  862.                 'skip$
  863.               if$
  864.               t "others" =
  865.                 { " \etal{}" * }
  866.                 { " and " * t * }
  867.               if$
  868.             }
  869.           if$
  870.         }
  871.         't
  872.       if$
  873.       nameptr #1 + 'nameptr :=
  874.       namesleft #1 - 'namesleft :=
  875.     }
  876.   while$
  877. }
  878.  
  879. FUNCTION {author.key}
  880. { author empty$
  881.     { "{"
  882.       key empty$
  883.         { cite$ #1 #3 substring$ }
  884.         'key
  885.       if$ *
  886.       "}" *
  887.     }
  888.     'author
  889.   if$
  890. }
  891.  
  892. FUNCTION {author.editor.key}
  893. { author empty$
  894.     { editor empty$
  895.         { "{"
  896.           key empty$
  897.             { cite$ #1 #3 substring$ }
  898.             'key
  899.           if$ *
  900.           "}" *
  901.         }
  902.         'editor
  903.       if$
  904.     }
  905.     'author
  906.   if$
  907. }
  908.  
  909. FUNCTION {editor.key}
  910. { editor empty$
  911.     { "{"
  912.       key empty$
  913.         { cite$ #1 #3 substring$ }
  914.         'key
  915.       if$ *
  916.       "}" *
  917.     }
  918.     'editor
  919.   if$
  920. }
  921.  
  922. FUNCTION {maybe.other.name.field}
  923. { swap$                         % [stack: other.field name]
  924.   duplicate$ empty$             % is the name empty?
  925.     { pop$                      % discard it [stack: other.field]
  926.       #1 swap$ 'skip$ if$       % try the other one
  927.     }
  928.     { swap$ pop$                % discard other.field
  929.     }
  930.   if$
  931. }
  932.  
  933. FUNCTION {calc.label.names}
  934. { type$ "proceedings" =
  935.     'editor
  936.     'author
  937.   if$
  938.   'editor maybe.other.name.field
  939.   'organization maybe.other.name.field
  940.   'key maybe.other.name.field
  941.   { "Cannot create a label name in " cite$ * warning$
  942.     cite$ #1 #3 substring$ } maybe.other.name.field
  943. }
  944.  
  945. FUNCTION {calc.short.label}
  946. { calc.label.names format.lab.names
  947.   'short.label :=
  948. }
  949.  
  950. FUNCTION {calc.label}
  951. { calc.short.label
  952.   short.label ", " *
  953.   year duplicate$ empty$
  954.      { pop$ "????" }
  955.      { purify$ #-1 #4 substring$ }
  956.   if$
  957.   *
  958.   'label :=
  959. }
  960.  
  961. FUNCTION {calc.long.label}
  962. { calc.label.names format.long.lab.names
  963.   'long.label :=
  964. }
  965.  
  966. FUNCTION {sort.format.names}
  967. { 's :=
  968.   #1 'nameptr :=
  969.   ""
  970.   s num.names$ 'numnames :=
  971.   numnames 'namesleft :=
  972.     { namesleft #0 > }
  973.     { nameptr #1 >
  974.         { "   " * }
  975.         'skip$
  976.       if$
  977.       s nameptr
  978.       "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}"
  979.       format.name$ 't :=
  980.       nameptr numnames = t "others" = and
  981.         { "et al" * }
  982.         { t sortify * }
  983.       if$
  984.       nameptr #1 + 'nameptr :=
  985.       namesleft #1 - 'namesleft :=
  986.     }
  987.   while$
  988. }
  989.  
  990. FUNCTION {sort.format.title}
  991. { 't :=
  992.   "A " #2
  993.     "An " #3
  994.       "The " #4 t chop.word
  995.     chop.word
  996.   chop.word
  997.   sortify
  998.   #1 global.max$ substring$
  999. }
  1000.  
  1001. FUNCTION {author.sort}
  1002. { author empty$
  1003.     { key empty$
  1004.         { "to sort, need author or key in " cite$ * warning$
  1005.           ""
  1006.         }
  1007.         { key sortify }
  1008.       if$
  1009.     }
  1010.     { author sort.format.names }
  1011.   if$
  1012. }
  1013.  
  1014. FUNCTION {author.editor.sort}
  1015. { author empty$
  1016.     { editor empty$
  1017.         { key empty$
  1018.             { "to sort, need author, editor, or key in " cite$ * warning$
  1019.               ""
  1020.             }
  1021.             { key sortify }
  1022.           if$
  1023.         }
  1024.         { editor sort.format.names }
  1025.       if$
  1026.     }
  1027.     { author sort.format.names }
  1028.   if$
  1029. }
  1030.  
  1031. FUNCTION {editor.sort}
  1032. { editor empty$
  1033.     { key empty$
  1034.         { "to sort, need editor or key in " cite$ * warning$
  1035.           ""
  1036.         }
  1037.         { key sortify }
  1038.       if$
  1039.     }
  1040.     { editor sort.format.names }
  1041.   if$
  1042. }
  1043.  
  1044. FUNCTION {presort}
  1045. { calc.label
  1046.   label sortify
  1047.   "    "
  1048.   *
  1049.   type$ "book" =
  1050.   type$ "inbook" =
  1051.   or
  1052.     'author.editor.sort
  1053.     { type$ "proceedings" =
  1054.         'editor.sort
  1055.         'author.sort
  1056.       if$
  1057.     }
  1058.   if$
  1059.   #1 entry.max$ substring$
  1060.   'sort.label :=
  1061.   sort.label
  1062.   *
  1063.   "    "
  1064.   *
  1065.   title field.or.null
  1066.   sort.format.title
  1067.   *
  1068.   #1 entry.max$ substring$
  1069.   'sort.key$ :=
  1070. }
  1071.  
  1072. ITERATE {presort}
  1073.  
  1074. SORT
  1075.  
  1076. STRINGS { last.label next.extra }
  1077.  
  1078. INTEGERS { last.extra.num }
  1079.  
  1080. FUNCTION {initialize.extra.label.stuff}
  1081. { #0 int.to.chr$ 'last.label :=
  1082.   "" 'next.extra :=
  1083.   #0 'last.extra.num :=
  1084. }
  1085.  
  1086. FUNCTION {forward.pass}
  1087. { last.label label =
  1088.     { last.extra.num #1 + 'last.extra.num :=
  1089.       last.extra.num int.to.chr$ 'extra.label :=
  1090.     }
  1091.     { "a" chr.to.int$ 'last.extra.num :=
  1092.       "" 'extra.label :=
  1093.       label 'last.label :=
  1094.     }
  1095.   if$
  1096. }
  1097.  
  1098. FUNCTION {reverse.pass}
  1099. { next.extra "b" =
  1100.     { "a" 'extra.label := }
  1101.     'skip$
  1102.   if$
  1103.   extra.label 'next.extra :=
  1104. }
  1105.  
  1106. EXECUTE {initialize.extra.label.stuff}
  1107.  
  1108. ITERATE {forward.pass}
  1109.  
  1110. REVERSE {reverse.pass}
  1111.  
  1112. FUNCTION {bib.sort.order}
  1113. { sort.label
  1114.   "    "
  1115.   *
  1116.   year field.or.null sortify
  1117.   *
  1118.   "    "
  1119.   *
  1120.   title field.or.null
  1121.   sort.format.title
  1122.   *
  1123.   #1 entry.max$ substring$
  1124.   'sort.key$ :=
  1125.   calc.long.label
  1126. }
  1127.  
  1128. ITERATE {bib.sort.order}
  1129.  
  1130. SORT
  1131.  
  1132. FUNCTION {begin.bib}
  1133. { preamble$ empty$
  1134.     'skip$
  1135.     { preamble$ write$ newline$ }
  1136.   if$
  1137.   "\begin{thebibliography}{}" write$ newline$
  1138. }
  1139.  
  1140. EXECUTE {begin.bib}
  1141.  
  1142. EXECUTE {init.state.consts}
  1143.  
  1144. ITERATE {call.type$}
  1145.  
  1146. FUNCTION {end.bib}
  1147. { newline$
  1148.   "\end{thebibliography}" write$ newline$
  1149. }
  1150.  
  1151. EXECUTE {end.bib}
  1152. %% 
  1153. %%
  1154. %% End of file `ltugbib.bst'.
  1155.